package com.xinfan.io.homework;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @Author xin
 * @Date 2022/6/9 14:40
 * @Version 1.0
 */
public class Homework2 {
    public static void main(String[] args) throws IOException {
        String src = "G:\\桌面\\test.txt";

        BufferedReader br = new BufferedReader(new FileReader(src));

        String line;
        //计数器
        int i = 1;

        while ((line = br.readLine()) != null) {
            System.out.println(i++ +" "+ line);
        }
        //关流
        br.close();

    }
}
